<template>
  <el-card class="box-card">
    <div v-if="title" slot="header" class="header">
      <img
        :src="require('../../assets/' + iconSrc)"
        :style="customStyle"
        alt=""
      >
      <div class="title">{{ title }}</div>
    </div>
    <div v-else slot="header" class="sub-header">
      <div class="sub-title">{{ subTitle }}</div>
      <div v-if="tip.length > 0" class="desc-wrap">
        （<span>说明：</span> <span class="desc-text">{{ tip }}</span>）
      </div>
    </div>
    <slot name="content" />

  </el-card>
</template>

<script>
export default {
  props: {
    iconSrc: {
      type: String,
      default: ''
    },
    title: {
      type: String,
      default: ''
    },
    subTitle: {
      type: String,
      default: ''
    },
    tip: {
      type: String,
      default: ''
    },
    customStyle: {
      type: Object,
      default () {
        return {}
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.box-card {
  margin-bottom: 16px;
  .header {
    display: flex;
    align-items: center;
    .title {
      margin-left: 8px;
      font-size: 18px;
      font-family: MicrosoftYaHei;
      font-weight: bold;
      color: #2860c3;
    }
  }
  .sub-header {
    display: flex;
    align-items: flex-end;
    .sub-title {
      height: 18px;
      font-size: 18px;
      font-family: MicrosoftYaHei;
      font-weight: bold;
      color: #333333;
    }
    .desc-wrap {
      height: 17px;
      font-size: 16px;
      font-family: MicrosoftYaHei;
      font-weight: 400;
      color: #666666;
      span:nth-child(1) {
        color: #ff0913;
      }
    }
  }
}
</style>
